/*
 * Copyright 2006-2008 the original author or authors.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package net.martinimix.domain.payment;

import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Calendar;

/**
 * Provides a customer account, such as a gift certificate, mileage account,
 * on-account credits, etc.
 * 
 * @author Scott Rossillo
 *
 */
public class Account implements PaymentMethod, Serializable {

	private static final long serialVersionUID = 1L;
	
	/**
	 * The the payment method type for account.
	 */
	public final static String PAYMENT_TYPE_ACCOUNT = "ACT";
	
	/**
	 * The account type for gift certificates.
	 */
	public final static String TYPE_GIFT_CERTIFICATE = "GCT";
	
	/**
	 * The status code for active accounts.
	 */
	public final static String STATUS_ACTIVE = "A";
	
	/**
	 * The status code for inactive accounts.
	 */
	public final static String STATUS_INACTIVE = "I";
	
	/**
	 * @@BusinessObjectProperty("act_id")
	 */
	private Long id;

	/**
	 * @@BusinessObjectProperty("accountNumber")
	 */
	private String number;
	
	/**
	 * @@BusinessObjectProperty("ownedBy")
	 */
	private Long customerId;
	
	/**
	 * @@BusinessObjectProperty("act_sku_id")
	 */
	private Long skuId;
	
	/**
	 * @@BusinessObjectProperty("act_orl_id")
	 */
	private Long orderLineId;
	
	/**
	 * @@BusinessObjectProperty("currentBalance")
	 */
	private BigDecimal balance;
	
	private BigDecimal originalBalance;
	
	private boolean transferrable;
	
	/**
	 * @@BusinessObjectProperty("currency_cd")
	 */
	private String currencyCode;
	
	/**
	 * @@BusinessObjectProperty("type_cd")
	 */
	private String typeCode;
	
	/**
	 * @@BusinessObjectProperty("status_cd") 
	 */
	private String statusCode;
	
	/**
	 * Expiration date.
	 */
	private Calendar expirationDate;
	
	/**
	 * @@BusinessObjectProperty("createDt") 
	 */
	private Calendar createdDate;
	
	/**
	 * @@BusinessObjectProperty("modifyDt") 
	 */
	private Calendar modifiedDate;
	
	/**
	 * Creates a new account.
	 */
	protected Account() {
		
		this.originalBalance = BigDecimal.valueOf(0, 2);
		this.balance  = BigDecimal.valueOf(0, 2);
		this.currencyCode = "USD";
		this.statusCode = STATUS_ACTIVE;
	}

	public Long getId() {
		return id;
	}

	public Long getCustomerId() {
		return customerId;
	}

	public Long getSkuId() {
		return skuId;
	}

	public Long getOrderLineId() {
		return orderLineId;
	}

	public BigDecimal getBalance() {
		return balance;
	}

	public BigDecimal getOriginalBalance() {
		return originalBalance;
	}

	public boolean isTransferrable() {
		return transferrable;
	}

	public String getCurrencyCode() {
		return currencyCode;
	}

	public String getTypeCode() {
		return typeCode;
	}

	/* (non-Javadoc)
	 * @see net.martinimix.domain.payment.PaymentMethod#getPaymentMethodTypeCode()
	 */
	public String getPaymentMethodTypeCode() {
		return PAYMENT_TYPE_ACCOUNT;
	}

	public String getStatusCode() {
		return statusCode;
	}

	public Calendar getExpirationDate() {
		return expirationDate;
	}

	public Calendar getCreatedDate() {
		return createdDate;
	}

	public Calendar getModifiedDate() {
		return modifiedDate;
	}

	/**
	 * Return this account number for this account.
	 * 
	 * @return the account number for this account
	 */
	public String getNumber() {
		return number;
	}

	public void setNumber(String number) {
		this.number = number;
	}

	public void setId(Long id) {
		this.id = id;
	}

	public void setCustomerId(Long customerId) {
		this.customerId = customerId;
	}

	public void setSkuId(Long skuId) {
		this.skuId = skuId;
	}

	public void setOrderLineId(Long orderLineId) {
		this.orderLineId = orderLineId;
	}

	public void setBalance(BigDecimal balance) {
		this.balance = balance;
	}

	public void setOriginalBalance(BigDecimal originalBalance) {
		this.originalBalance = originalBalance;
	}

	public void setTransferrable(boolean transferrable) {
		this.transferrable = transferrable;
	}

	public void setCurrencyCode(String currencyCode) {
		this.currencyCode = currencyCode;
	}

	public void setTypeCode(String typeCode) {
		this.typeCode = typeCode;
	}

	public void setStatusCode(String statusCode) {
		this.statusCode = statusCode;
	}

	public void setExpirationDate(Calendar expirationDate) {
		this.expirationDate = expirationDate;
	}

	public void setCreatedDate(Calendar createdDate) {
		this.createdDate = createdDate;
	}

	public void setModifiedDate(Calendar modifiedDate) {
		this.modifiedDate = modifiedDate;
	}
	
	
	
	
}
